﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Collections.ObjectModel;
using PhoneAppSTS.Utils.Data;
using System.ComponentModel;
using System.Windows.Media.Imaging;
using System.Collections.Generic;

namespace PhoneAppSTS.Utils
{
    public class MedicineDataUtils : INotifyPropertyChanged
    {
        private ObservableCollection<MedicineData> medicineList;
        public ObservableCollection<MedicineData> MedicineList 
        {
            get
            {
                return medicineList;
            }
            set
            {
                medicineList = value;
                OnPropertyChanged("MedicineList");
            }
        }

        private Dictionary<MedicineData, int> medicinesForTakenList;
        public Dictionary<MedicineData, int> MedicinesForTakenList 
        {
            get
            {
                return medicinesForTakenList;
            }
            set
            {
                medicinesForTakenList = value;
                OnPropertyChanged("MedicinesForTakenList");
            }
        }

        private void OnPropertyChanged(string p)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(p));
            }
        }

        public void DownloadMedicineData()
        {
            //ToDo
            //sciaganie danych o lekach albo korzystanie z lokalnych
            MedicineData m1 = new MedicineData();
            m1.TitleMedicine = "Lek 1";
            m1.Description = "Opis leku 1. Opis leku 1.Opis leku 1.Opis leku 1.Opis leku 1.";
            m1.ImageUrl = new BitmapImage(new Uri("/Images/m1.jpg",UriKind.RelativeOrAbsolute));
            m1.TimeForMedicine = new Dictionary<int,int>();
            m1.TimeForMedicine.Add(Constants.EVENING, 1);
            

            MedicineData m2 = new MedicineData();
            m2.TitleMedicine = "Lek 2";
            m2.Description = "Opis leku 2. Opis leku 1.Opis leku 1.Opis leku 1.Opis leku 1.";
            m2.ImageUrl = new BitmapImage(new Uri("/Images/m2.jpg", UriKind.RelativeOrAbsolute));
            m2.TimeForMedicine = new Dictionary<int, int>();
            m2.TimeForMedicine.Add(Constants.MORNING,2);
            m2.TimeForMedicine.Add(Constants.MIDDAY,1);

            MedicineData m3 = new MedicineData();
            m3.TitleMedicine = "Lek 3";
            m3.Description = "Opis leku 3. Opis leku 3.Opis leku 1.Opis leku 1.Opis leku 1.";
            m3.ImageUrl = new BitmapImage(new Uri("/Images/m3.jpg", UriKind.RelativeOrAbsolute));
            m3.TimeForMedicine = new Dictionary<int, int>();
            m3.TimeForMedicine.Add(Constants.MORNING,1);

            MedicineList.Add(m1);
            MedicineList.Add(m2);
            MedicineList.Add(m3);

        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
